﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace uz.control.CustomControl
{
    public partial class C_EditorBase : UserControl
    {
        public C_EditorBase()
        {
            InitializeComponent();
        }


        protected override void OnParentChanged(EventArgs e)
        {
            base.OnParentChanged(e);

            Form frm = FindForm();

            if (frm != null)
            {
                frm.KeyPreview = true;
                frm.KeyDown+=new KeyEventHandler(frm_KeyDown);
            }
        }

        void frm_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Escape)
            {
                Form frm = FindForm();
                frm.DialogResult = DialogResult.Cancel;
                frm.Close();
            }
        }

        public UzTreeNode Node { get; set; }

    }
}
